[C#] how to do Exception Handling & Tracing

Posted by shrimpy on Stack Overflow See other posts from Stack Overflow or by shrimpy
Published on 2010-05-06T05:33:11Z Indexed on 2010/05/06 5:38 UTC
Read the original article Hit count: 225

Hi all, i am reading some C# books, and got some exercise don't know how to do, or not sure what does the question mean.

Problem:

After working for a company for some time, your skills as a knowledgeable developer are recognized, and you are given the task of “policing” the implementation of exception handling and tracing in the source code (C#) for an enterprise application that is under constant incremental development. The two goals set by the product architect are:

  1. 100% of methods in the entire application must have at least a standard exception handler, using try/catch/finally blocks; more complex methods must also have additional exception handling for specific exceptions

  2. All control flow code can optionally write “tracing” information to assist in debugging and instrumentation of the application at run-time in situations where traditional debuggers are not available (eg. on staging and production servers).

(i am not quite understand these criterias, i came from the java world, java has two kind of exception, check and unchecked exception. Developer must handle checked exception, and do logging. about unchecked exception, still do logging maybe, but most of the time we just throw it. however here comes to C#, what should i do????)

Question for Problem:

  1. List rules you would create for the development team to follow, and the ways in which you would enforce rules, to achieve these goals.

  2. How would you go about ensuring that all existing code complies with the rules specified by the product architect; in particular, what considerations would impact your planning for the work to ensure all existing code complies?

© Stack Overflow or respective owner

Related posts about exception-handling

Related posts about bug-tracking